﻿<%@ WebHandler Language="C#" Class="Abort" %>
using System;
using System.Web;
using System.Xml.Linq;
public class Abort : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "application/xml";
        context.Response.Charset = "utf-8";
        string guid = context.Request.Form["guid"];
        bool abort = string.IsNullOrEmpty(context.Request.Form["abort"]) ? false : true;
        Maticsoft.Common.DownloadingFileInfo info = context.Cache[guid] as Maticsoft.Common.DownloadingFileInfo;
        if (info != null)
        {
            info.Abort = abort;
            context.Cache[guid] = info;
        }
        XDocument doc = new XDocument();
        XElement root = new XElement("root");
        XElement flag = new XElement("flag",info==null?"false":"true");
        root.Add(flag);
        doc.Add(root);
        context.Response.Write(doc.ToString());
        context.Response.End();
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}